//
//  JJMeViewController.m
//  DemoPro
//
//  Created by vpjacob on 2017/4/7.
//  Copyright © 2017年 vpjacob. All rights reserved.
//

#import "JJMeViewController.h"
#import "JJTestNetApi.h"
#import "JJTestDemoModel.h"

@interface JJMeViewController ()

@end

@implementation JJMeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.jjTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    [self.view addSubview:self.jjTableView];
    self.title = @"我的";
    [self requestNet];
}

- (void)requestNet {
    [super didReceiveMemoryWarning];
    JJTestNetApi* api = [JJTestNetApi new];
    [api startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
        NSDictionary* dict = request.responseObject[@"videoSidList"];
        self.dataArray = [JJTestDemoModel changeResponseJSONObject:dict];;
        [self.jjTableView reloadData];
    } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        
    }];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.contentView.backgroundColor = [UIColor redColor];
    JJTestDemoModel* model = self.dataArray[indexPath.row];
    cell.textLabel.text = model.imgsrc;
    NSLog(@"%@",model.imgsrc);
    return cell;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
